package com.starlink.model.util;

import com.starlink.model.dtomapper.ShoppingCartDtoMapper;
import com.starlink.model.domain.ShoppingCartDO;
import com.starlink.model.vo.ShoppingCartVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class ShoppingCartConvert {

    public static List<ShoppingCartVO> buildShoppingCartVoList(List<ShoppingCartDO> shoppingCartDOList) {
        if (CollectionUtils.isEmpty(shoppingCartDOList)) {
            return Lists.newArrayList();
        }
        List<ShoppingCartVO> shoppingCartVOList = new ArrayList<>();
        for (ShoppingCartDO shoppingCartDO : shoppingCartDOList) {
            shoppingCartVOList.add(ShoppingCartDtoMapper.INSTANCE.do2VO(shoppingCartDO));
        }

        return shoppingCartVOList;
    }
}
